// 导入koa-router模块
const Router = require('koa-router');
// 创建koa-router的实例router
const router = new Router();
const homeControllers = require('../controllers/home');
const newsControllers = require('../controllers/news');
const wallpaperControllers = require('../controllers/wallpaper');
// 定义模型 可以公用 schema $ref
/**
 * @swagger
 * definitions:
 *   Login:
 *     required:
 *       - username
 *       - password
 *     properties:
 *       username:
 *         type: string
 *       password:
 *         type: string
 *       path:
 *         type: string
 */


//  tags 可以理解成借口分类  parameters 参数
/**
 * @swagger
 * /login:
 *   post:
 *     description: 用户登入
 *     tags: [用户登入模块]
 *     produces:
 *       - application/json
 *     parameters:
 *       - name: password
 *         description: 用户密码.
 *         in: formData
 *         required: true
 *         type: string
 *       - name: username
 *         description: 用户名.
 *         in: formData
 *         required: true
 *         type: string
 *     responses:
 *       200:
 *         description: 登入成功
 *         schema:
 *           type: object
 *           $ref: '#/definitions/Login'
 *   
 */

router.get('/news', newsControllers.render)
router.get('/wallpaper', wallpaperControllers.render)
router.get('/temp', homeControllers.template)

router.get('/', homeControllers.getHomePage)

module.exports = router